const mongoose = require("mongoose");
const uuid = require("uuid")
const {Schema, model} = mongoose;

const userSchema = new Schema(
	{
		__v: {type: Number, select: false},
		id: {type:String,required:false,default:()=>uuid.v4()},
		name: {type: String, required: true},  // 用户名
		password: {type: String, required: true, select: false},  // 密码
		avatar: {type: String},  // 头像
		role: {type: Array, default: ['admin']},
	},
	{timestamps: true}
);

module.exports = model("Auth", userSchema);
